Unlike in the real world, Starfleet has direct contact with alien governments. In the real world, it typically would not be admirals or ship commanding officers who would directly contact/liaise with governments. An example is Chancellor K'mpec asking Picard to be an Arbiter of Succession. In most real life foreign contacts, either the head of government and/or head of state would hold high-level discussions with other sovereign states, backed up by a state diplomatic corps. An army general or a naval admiral wouldn't generally get involved. Is Starfleet thus a part military and part political arm of the Federation, unlike real world armed forces?
Captains and Admirals in the days of sail might have contact with foreign governments. ST is sometimes described as Hornblower in space. I.e an 18th Century navy in space.
The Klingons asked for Picard, what is the UFP to do? Say no and deal with a Klingon Civil War that could turn the empire against them or even just weaken their most powerful ally? Tell them they are sending someone else and they will just have to live with it? The Klingon response would be somewhere between go **** yourself and disruptor fire. They want Picard that is who they'll get. As for Ambassadors sure the Federation has lots of them but not on every Starship, they are mobile moving between where they are needed be it other Federation Worlds or other Governments like Telarians or Gorn. It takes months to move around just Federation Space so this is not an on demand service we are talking about. Star Fleet officers are briefed on how to make First Contact but it is mostly a Hi how are you sort of deal. The Ambassadors only come in 15 minutes after the giant Crystal thing / Evil Computer / Deadly Virus is heroically torpedoed after one last plea for peaceful coexistence or Speeched at to either death or reform / threatened off by secret back up plan. By the time they get there the Enterprise has moved on to their next adventure. Star Fleet Captains basically render aid when appropriate and make First Contacts, the diplomatic core handles all the boring stuff such as treaties and trade agreements. So no not really but Starfleet is usually the first on the ground anywhere so their Captains have to act like Ambassadors because what they say or do will have lasting repercussions for the Federation.
I always saw Starfleet as the Federation's deep-space operations agency, empowered to act on its behalf in both domestic and foreign affairs whenever necessary.
Starfleet is definitely at least somewhat diplomatic, if not political. We've seen numerous episodes where our hero ship is en route to a conference, meeting with representatives of planets, etc. Plus we know that Ben Sisko, as a young officer, had routine contact with Curzon Dax, a Fed Ambassador.
TVH showed the UFP... what? Security Council? President's Gallery? Ruling Council? Parliament or Congress? Whatever it was, there were several Starfleet uniformed personnel. As guests? Observers? Or does Starfleet have members directly as UFP governing members? I'll leave it for others to decide.
Starfleet considers their first purpose to be exploring the galaxy and making contact with new races. The military became the focus in many of the major arcs, but they consider that a function of necessity.
Starfleet is composed of several corps: * Deep Space Exploratory Corps * Diplomatic Corps * Scientific Corps The Federation has a Bureau of Planetary Treaties. This body has a separate corps for diplomacy.
My impression is that Starfleet is the Federation's general purpose errand boys. Just about anything that need to be done, Starfleet gets the assignment. Everything from high visibility diplomatic glamor jobs to the little shit jobs. Their first priority would be offense/defense. It might not be what occupies most of their time, but anything else Starfleet is doing at the moment gets dropped if the Federation need them to saber rattle, or go and shoot somebody.
In many opening hails, Starfleet Captains often say they represent the UFP. They make the initial contact then once it goes further the diplomats and politicians take over. Starfleets primary mandate is to explore and make contact with new civilisations, if they don't have the authority to meet with alien leaders then they're operating with their hands tied behind their back.