• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

thoughtspot / mcp-server / 15691145450

16 Jun 2025 08:23PM UTC coverage: 19.595% (-0.04%) from 19.63%
15691145450

Pull #31

github

web-flow
Merge f989fca49 into b46edf0d4
Pull Request #31: Add locale header for every request with ThoughtSpot Rest client

9 of 98 branches covered (9.18%)

Branch coverage included in aggregate %.

3 of 8 new or added lines in 1 file covered. (37.5%)

78 of 346 relevant lines covered (22.54%)

0.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

18.92
/src/servers/api-server.ts
1
import { Hono } from 'hono'
2
import type { Props } from '../utils';
3
import {
4
    createLiveboard,
5
    getAnswerForQuestion,
6
    getDataSources,
7
    getRelevantQuestions
8
} from '../thoughtspot/thoughtspot-service';
9
import { getThoughtSpotClient } from '../thoughtspot/thoughtspot-client';
10

11
const apiServer = new Hono<{ Bindings: Env & { props: Props } }>()
2✔
12

13
apiServer.post("/api/tools/relevant-questions", async (c) => {
2✔
14
    const { props } = c.executionCtx;
×
15
    const { query, datasourceIds, additionalContext } = await c.req.json();
×
16
    const client = getThoughtSpotClient(props.instanceUrl, props.accessToken);
×
17
    const questions = await getRelevantQuestions(query, datasourceIds, additionalContext || '', client);
×
18
    return c.json(questions);
×
19
});
20

21
apiServer.post("/api/tools/get-answer", async (c) => {
2✔
22
    const { props } = c.executionCtx;
×
23
    const { question, datasourceId } = await c.req.json();
×
24
    const client = getThoughtSpotClient(props.instanceUrl, props.accessToken);
×
25
    const answer = await getAnswerForQuestion(question, datasourceId, false, client);
×
26
    return c.json(answer);
×
27
});
28

29
apiServer.post("/api/tools/create-liveboard", async (c) => {
2✔
30
    const { props } = c.executionCtx;
×
31
    const { name, answers } = await c.req.json();
×
32
    const client = getThoughtSpotClient(props.instanceUrl, props.accessToken);
×
33
    const liveboardUrl = await createLiveboard(name, answers, client);
×
34
    return c.text(liveboardUrl);
×
35
});
36

37
apiServer.get("/api/resources/datasources", async (c) => {
2✔
38
    const { props } = c.executionCtx;
×
39
    const client = getThoughtSpotClient(props.instanceUrl, props.accessToken);
×
40
    const datasources = await getDataSources(client);
×
41
    return c.json(datasources);
×
42
});
43

44
apiServer.post("/api/rest/2.0/*", async (c) => {
2✔
45
    const { props } = c.executionCtx;
×
46
    const path = c.req.path;
×
47
    const method = c.req.method;
×
48
    const body = await c.req.json();
×
49
    return fetch(props.instanceUrl + path, {
×
50
        method,
51
        headers: {
52
            "Authorization": `Bearer ${props.accessToken}`,
53
            "Accept": "application/json",
54
            "Content-Type": "application/json",
55
            "User-Agent": "ThoughtSpot-ts-client",
56
        },
57
        body: JSON.stringify(body),
58
    });
59
});
60

61
apiServer.get("/api/rest/2.0/*", async (c) => {
2✔
62
    const { props } = c.executionCtx;
×
63
    const path = c.req.path;
×
64
    const method = c.req.method;
×
65
    return fetch(props.instanceUrl + path, {
×
66
        method,
67
        headers: {
68
            "Authorization": `Bearer ${props.accessToken}`,
69
            "Accept": "application/json",
70
            "User-Agent": "ThoughtSpot-ts-client",
71
        }
72
    });
73
});
74

75
export {
76
    apiServer,
77
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc